<template>
  <div>
    <el-row :gutter="20" v-if="welpage.colorful != ''">
      <el-col :span="6">
        <div class="grid-content color1">
          <img src="../assets/fwrs.png" alt="" />
          <div class="access ttex">
            访问人数<span>{{ welpage.colorful.vCount }}</span>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content color2">
          <img src="../assets/rw.png" alt="" />
          <p class="tasks ttex">
            任务总数<span>{{ welpage.colorful.pCount }}</span>
          </p>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content color3">
          <img src="../assets/jl.png" alt="" />
          <p class="reward ttex">
            总奖励<span>{{ welpage.colorful.aMoney }}</span>
          </p>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content color4">
          <img src="../assets/jljl.png" alt="" />
          <p class="rewardde ttex">
            已发奖励<span>{{ welpage.colorful.oMoney }}</span>
          </p>
        </div>
      </el-col>
    </el-row>
    <div class="mid">
      <el-row>
        <el-col :span="12">
          <div class="grid-content gd-bg">
            <el-container>
              <el-header
                ><div class="grid">
                  <i class="el-icon-s-comment"></i>新增信息
                </div></el-header
              >
              <el-main>
                <div class="midmseg" v-if="welpage.userdata != ''">
                  <div class="tex">
                    <span>{{ welpage.userdata.tAddUser }}</span>
                    <p>今日新增</p>
                  </div>
                  <div class="tex">
                    <span>{{ welpage.userdata.lAddUser }}</span>
                    <p>昨日新增</p>
                  </div>
                  <div class="tex">
                    <span>{{ welpage.userdata.mAddUser }}</span>
                    <p>本月新增</p>
                  </div>
                  <div class="tex">
                    <span>{{ welpage.userdata.aAddUser }}</span>
                    <p>会员总数</p>
                  </div>
                </div>
              </el-main>
            </el-container>
          </div></el-col
        >
        <el-col :span="12">
          <div class="grid-content gd-bg1">
            <el-container>
              <el-header>
                <div class="grid">
                  <i class="el-icon-s-opportunity"></i>任务一览
                </div></el-header
              >
              <div class="shop-bg">
                <el-container>
                  <el-main class="shop-l back">
                    <div class="back">
                      <span>商品</span>
                      <hr style="width: 103px" />
                      <div class="ttex">
                        新增：<span class="ttex-n">{{ nz }}</span
                        >总数:<span>{{ tt }}</span>
                      </div>
                    </div>
                  </el-main>
                  <el-main class="back shop-l">
                    <div>
                      <span class="line">订单</span>
                      <hr style="width: 103px" />
                      <div class="ttex">
                        总共：<span class="ttex-n">{{ lt }}</span
                        >待发货:<span>{{ lh }}</span>
                      </div>
                    </div>
                  </el-main>
                </el-container>
              </div>
            </el-container>
          </div></el-col
        >
      </el-row>
    </div>
    <div class="wel-footer">
      本周热搜排行：
      <div class="tag-group">
        <span class="tag-group__title"></span>
        <el-tag
          v-for="item in items"
          :key="item.id"
          :type="item.type"
          effect="dark"
        >
          {{ item.userach }}
        </el-tag>
      </div>
    </div>
    <div class="chag">
      <el-button slot="reference" @click="cdialogVisible = true"
        >查看课表</el-button
      >
      <el-dialog title="提示" :visible.sync="cdialogVisible" width="80%">
        <cours></cours>
        <span slot="footer" class="dialog-footer">
          <el-button @click="cdialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="cdialogVisible = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>
      <el-button type="text" @click="dialogVisible = true">发布活动</el-button>
      <el-dialog :visible.sync="dialogVisible" width="70%">
        <editor ref="clayEditor"></editor>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="welcour">确 定</el-button>
        </span>
      </el-dialog>
    </div>
    <div class="chcrc">
      <div class="chcrce">
      <!-- 圈子 -->
      <div class="wcicl">
        <div class="Icon">&#xe64a;</div>
        <div class="wcicle">圈子部落</div>
      </div>
      </div>
      <!-- 学校公告 -->
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>学校公告</span>
        </div>
        <div class="scanno">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="学校通知" name="first"><el-table
    :data="schnotData"
    height="250"
    border
    style="width: 100%">
    <el-table-column
      prop="date"
      label="日期"
      width="180">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="address"
      label="地址">
    </el-table-column>
  </el-table>
  </el-tab-pane>
            <el-tab-pane label="校园活动" name="second">配置管理</el-tab-pane>
            <el-tab-pane label="平台活动" name="third">角色管理</el-tab-pane>
          </el-tabs>
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>
var that;
import cours from "../components/element/cours";
import editor from "../components/element/editor";
export default {
  components: { editor, cours },
  methods: {
  },
  welcour() {
    console.log(this.$refs.clayEditor.content);
    // this.content= ''
    this.dialogVisible = false;
    // this.$forceUpdate()
    this.$refs.clayEditor.content = ""; //this.$refs.xxx(其中xxx是在某个子组件定义的（ref='xxx'）可以获取子组件的所有数据包括方法)
  },
  handleClose(done) {
    this.$confirm("确认关闭？")
      .then((_) => {
        done();
      })
      .catch((_) => {});
  },
  data() {
    return {
      // 学校通知
      schnotData: [{
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-08',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-06',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }, {
          date: '2016-05-07',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }],
      //课程表
      msg: "",
      classTableData: {
        weeks: ["", "一", "二", "三", "四", "五", "六", "日"],
        courses: [],
      },
      info: [
        [
          {
            id: 1,
            classId: 2,
            lessonsTime: "8:00-9:40",
            lessonsName: "计算机导论",
            lessonsAddress: "二教302",
            lessonsTeacher: "吴老师",
            lessonsRemark: "1-17周",
            lessonsNumber: "一",
            weekday: "星期一",
          },
          {
            id: 19,
            classId: 2,
            lessonsTime: "8:00-9:40",
            lessonsName: "编译原理",
            lessonsAddress: "二教302",
            lessonsTeacher: "吴老师",
            lessonsRemark: "1-5,8-12周",
            lessonsNumber: "一",
            weekday: "星期四",
          },
        ],
        [{}, {}, {}],
        [{}, {}, {}],
      ],
      cdialogVisible: false,
      content: "",
      dialogVisible: false,
      //弹出课表
      gridData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
      nz: 5,
      tt: 13,
      lt: 15,
      lh: 3,
      items: [],
      //首页数据
      welpage: {
        userdata: "",
        colorful: "",
        aMoney: "",
        oMoney: "",
        pCount: "",
        vCount: "",
        aAddUser: "",
        lAddUser: "",
        mAddUser: "",
        tAddUser: "",
      },
      //热搜标签
    };
  },
  //课程表
  created() {},
  mounted: async function () {
    const { data: res } = await this.$http.get("/admin/main");
    console.log(res);
    this.welpage = res.data;
    this.items = res.data.logRecord;
    console.log(22222, this.welpage);
  },
};
</script>
<style lang="scss" >
.clearfix {
  text-align: left;
  margin-left: 20px;
}
.box-card /deep/ .el-card__header {
  padding: 0;
}
.box-card /deep/ .el-card__body {
      margin-left: 20px;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 80%;
}
.chcrc {
  
  .chcrce{
    background-color: #f7f6f6;
        margin-right: 20px;
  }
  .wcicl {
    // display: inline;
  display: flex;
    width: 11%;
    padding: 25px;
    padding-left: 0;
    border-radius: 11px;
    .Icon {
      font-size: 50px;
    }
    .wcicle {
      margin-top: 16px;
    }
  }
}
.tag-group span {
  margin-left: 10px;
}
.wel-footer {
  display: flex;
}
.el-main {
  color: #333;
  text-align: center;
  line-height: 40px;
  flex: 0.1;
}
.ttex-n {
  margin-right: 20px;
}
.color1 {
  background-color: #67c23a;
  box-shadow: 1px 10px 12px 0 rgba(142, 117, 27, 0.41);
}
.color2 {
  background-color: #e6a23c;
  box-shadow: 1px 10px 12px 0 rgba(142, 117, 27, 0.41);
}
.color3 {
  background-color: #f56c6c;
  box-shadow: 1px 10px 12px 0 rgba(142, 117, 27, 0.41);
}
.color4 {
  background-color: #909399;
  box-shadow: 1px 10px 12px 0 rgba(142, 117, 27, 0.41);
}
.foter-u {
  list-style: none;
  display: flex;
  padding: 0px;
}
.foter-u li {
  display: flex;
  background-color: #f9fafc;
  align-items: center;
  justify-items: center;
  border-radius: 10px;
  margin-right: 50px;
}
.foter-u img {
  width: 80px;
  height: 80px;
  margin: 55px;
}
.mid .el-row {
  display: flex;
}
.shop-bg .shop-l {
  padding: 0;
  margin: 20px;
}
.gd-bg .el-main {
  background-color: aliceblue;
}
.mid {
  /* display: flex; */
  white-space: nowrap;
}
.mid .el-col-12 {
  /* width: 800px; */
  margin-right: 10px;
  box-shadow: 1px 10px 12px 0 rgba(29, 28, 28, 0.1);
}
.mid :last-child {
  /* margin-right: 0; */
}
.shop-bg .el-container {
  background-color: beige;
}
.back {
  margin: 0px;
  padding: 10px;
  background-color: rgb(214, 214, 185);
  border-radius: 10px;
}
.grid {
  align-content: center;
  justify-content: center;
  border-bottom: 1px solid rgb(221, 206, 159);
}
.gd-bg,
.gd-bg1 {
  display: flex;
  text-align: left;
  justify-content: center;
}
.gd-bg {
  background: #f9fafc;
  border: 1px solid #f9fafc;
}
.gd-bg1 {
  background-color: beige;
  border: 1px solid #e5e9f2;
}
/* .el-aside {
  width: 40%;
} */
.midmseg {
  display: flex;
  justify-content: space-around;
}
.midmseg div {
  /* border:1px solid #d3dce6; */
  margin-left: 5px;
}

.tex {
  margin: 0;
  font-family: sans-serif;
  white-space: nowrap;
  font-weight: bold;
}
.ttex {
  margin: 0;
  color: #f9fafc;
  font-family: sans-serif;
  white-space: nowrap;
  font-weight: bold;
}
.ttex span:hover {
  cursor: pointer;
}
.grid-content img {
  height: 60px;
  width: 60px;
  margin-top: 5px;
  /* color: aqua; */
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #409eff;
  color: #fff;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
